import request from '#/utils/requestAbort';

//黑龙江、陕西、宁夏
export const useNewServers = ['PDBLJ', 'PXBSX', 'PXBNX'];

export async function querypowerGenerationData(params, marketId) {
  const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`${prefixUrl}/powerGenerationPlan/powerGenerationData`, {
    method: 'POST',
    data: params,
  });
}

// 省份-交易中心-场站（数据权限）
export async function queryMarketList(menuCode) {
  return request(`/power/dataPower/common/${menuCode}/t_station`, {
    method: 'GET',
  });
}

export async function powerGenerationPlanList(params, marketId) {
  const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`${prefixUrl}/powerGenerationPlan/powerGenerationPlanList`, {
    method: 'POST',
    data: params,
  });
}
// export async function queryReferenceYears(params) {
//   return request('/fanrun/powerGenerationPlan/referenceYears', {
//     method: 'POST',
//     data: params,
//   });
// }
export async function powerGenerationStatusPlanCount(params, marketId) {
  const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`${prefixUrl}/powerGenerationPlan/powerGenerationStatusPlanCount`, {
    method: 'POST',
    data: params,
  });
}

//黑龙江的面板统计数量
// export async function powerGenerationStatusHljPlanCount(params) {
//   return request(`/private-business/powerGenerationPlan/powerGenerationStatusPlanCount`, {
//     method: 'POST',
//     data: params,
//   });
// }

export async function getStationsByIds(params, marketId) {
  const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`${prefixUrl}/stationConfig/stationConfigInfo`, {
    method: 'POST',
    data: params,
  });
}
export async function saveYearToMonthPowerGenerationPlan(params, marketId) {
  const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`${prefixUrl}/powerGenerationPlan/saveYearToMonthPowerGenerationPlan`, {
    method: 'POST',
    data: params,
  });
}
export async function publishPowerGenerationPlan(params, marketId) {
  const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`${prefixUrl}/powerGenerationPlan/publishPowerGenerationPlan`, {
    method: 'POST',
    data: params,
  });
}
export async function delPowerGenerationPlan(params, marketId) {
  const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`${prefixUrl}/powerGenerationPlan/delPowerGenerationPlan`, {
    method: 'POST',
    data: params,
  });
}
// export async function saveYearPowerGenerationPlan(params) {
//   return request('/fanrun/powerGenerationPlan/saveYearPowerGenerationPlan', {
//     method: 'POST',
//     data: params,
//   });
// }

export async function powerGenerationPlanOperateLog(params, marketId) {
  const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`${prefixUrl}/powerGenerationPlan/powerGenerationPlanOperateLog`, {
    method: 'POST',
    data: params,
  });
}

export async function getPowerGenerationPlanList_API(params, marketId) {
  // const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`/private-business/nx/powerGenerationPlan/time/periods/list`, {
    method: 'POST',
    data: params,
  });
}

export async function addPowerGenerationPlan_API(data, marketId) {
  // const prefixUrl = `${useNewServers.includes(marketId) ? '/private-business' : '/disclosure'}`;
  return request(`/private-business/nx/powerGenerationPlan/time/periods/add`, {
    method: 'POST',
    data,
  });
}
